﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DAL;
using BLL;

public partial class ERDS_LRD : System.Web.UI.Page
{

    BLLEeds BE = new BLLEeds();
    string errMsg = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DateTime dt = System.DateTime.Now;
            this.DateLR.Value = dt.AddDays(-1).ToString("yyyy-MM-dd");

            string[] point = new string[45];

            point[1] = "1fdl";
            point[2] = "2fdl";
            point[3] = "3fdl";
            point[4] = "4fdl";
            point[5] = "1swdl";
            point[6] = "2swdl";
            point[7] = "3swdl";
            point[8] = "4swdl";
            point[9] = "1zjcydl";
            point[10] = "2zjcydl";
            point[11] = "3zjcydl";
            point[12] = "4zjcydl";
            point[13] = "1tldl";
            point[14] = "2tldl";
            point[15] = "3tldl";
            point[16] = "4tldl";
            point[17] = "1yxxs";
            point[18] = "2yxxs";
            point[19] = "3yxxs";
            point[20] = "4yxxs";
            point[21] = "1gjtrl";
            point[22] = "2gjtrl";
            point[23] = "3gjtrl";
            point[24] = "4gjtrl";
            point[25] = "0qcqbbydl";
            point[26] = "0qcbjsl";
            point[27] = "0rlmrl";
            point[28] = "0pdchml";
            point[29] = "0qchsl1";
            point[30] = "0qchsl2";
            point[31] = "0dwsdl";
            point[32] = "0dwgdl";

            ArrayList list = BE.SelectSGLRDAY(DateTime.Parse(this.DateLR.Value).ToString("yyyy-MM-dd"), point, out  errMsg);

            string[] val = (string[])list[1];

            this.fdl1.Value = val[1];
            this.fdl2.Value = val[2];
            this.fdl3.Value = val[3];
            this.fdl4.Value = val[4];
            this.swdl1.Value = val[5];
            this.swdl2.Value = val[6];
            this.swdl3.Value = val[7];
            this.swdl4.Value = val[8];
            this.zjcydl1.Value = val[9];
            this.zjcydl2.Value = val[10];
            this.zjcydl3.Value = val[11];
            this.zjcydl4.Value = val[12];
            this.tldl1.Value = val[13];
            this.tldl2.Value = val[14];
            this.tldl3.Value = val[15];
            this.tldl4.Value = val[16];
            this.yxxs1.Value = val[17];
            this.yxxs2.Value = val[18];
            this.yxxs3.Value = val[19];
            this.yxxs4.Value = val[20];
            this.gjtrl1.Value = val[21];
            this.gjtrl2.Value = val[22];
            this.gjtrl3.Value = val[23];
            this.gjtrl4.Value = val[24];
            this.qcqbbydl0.Value = val[25];
            this.qcbjsl0.Value = val[26];
            this.rlmrl0.Value = val[27];
            this.pdchml0.Value = val[28];
            this.qchsl10.Value = val[29];
            this.qchsl20.Value = val[30];
            this.dwsdl0.Value = val[31];
            this.dwgdl0.Value = val[32];

            this.show.InnerHtml = "";
        }
    }

    protected void LRDRQ_Click(object sender, EventArgs e)
    {
        string[] point = new string[45];

        point[1] = "1fdl";
        point[2] = "2fdl";
        point[3] = "3fdl";
        point[4] = "4fdl";
        point[5] = "1swdl";
        point[6] = "2swdl";
        point[7] = "3swdl";
        point[8] = "4swdl";
        point[9] = "1zjcydl";
        point[10] = "2zjcydl";
        point[11] = "3zjcydl";
        point[12] = "4zjcydl";
        point[13] = "1tldl";
        point[14] = "2tldl";
        point[15] = "3tldl";
        point[16] = "4tldl";
        point[17] = "1yxxs";
        point[18] = "2yxxs";
        point[19] = "3yxxs";
        point[20] = "4yxxs";
        point[21] = "1gjtrl";
        point[22] = "2gjtrl";
        point[23] = "3gjtrl";
        point[24] = "4gjtrl";
        point[25] = "0qcqbbydl";
        point[26] = "0qcbjsl";
        point[27] = "0rlmrl";
        point[28] = "0pdchml";
        point[29] = "0qchsl1";
        point[30] = "0qchsl2";
        point[31] = "0dwsdl";
        point[32] = "0dwgdl";

        ArrayList list = BE.SelectSGLRDAY(DateTime.Parse(this.DateLR.Value).ToString("yyyy-MM-dd"), point, out errMsg);

        string[] val = (string[])list[1];

        this.fdl1.Value = val[1];
        this.fdl2.Value = val[2];
        this.fdl3.Value = val[3];
        this.fdl4.Value = val[4];
        this.swdl1.Value = val[5];
        this.swdl2.Value = val[6];
        this.swdl3.Value = val[7];
        this.swdl4.Value = val[8];
        this.zjcydl1.Value = val[9];
        this.zjcydl2.Value = val[10];
        this.zjcydl3.Value = val[11];
        this.zjcydl4.Value = val[12];
        this.tldl1.Value = val[13];
        this.tldl2.Value = val[14];
        this.tldl3.Value = val[15];
        this.tldl4.Value = val[16];
        this.yxxs1.Value = val[17];
        this.yxxs2.Value = val[18];
        this.yxxs3.Value = val[19];
        this.yxxs4.Value = val[20];
        this.gjtrl1.Value = val[21];
        this.gjtrl2.Value = val[22];
        this.gjtrl3.Value = val[23];
        this.gjtrl4.Value = val[24];
        this.qcqbbydl0.Value = val[25];
        this.qcbjsl0.Value = val[26];
        this.rlmrl0.Value = val[27];
        this.pdchml0.Value = val[28];
        this.qchsl10.Value = val[29];
        this.qchsl20.Value = val[30];
        this.dwsdl0.Value = val[31];
        this.dwgdl0.Value = val[32];

        this.show.InnerHtml = "";
    }

    protected void LRDSave_Click(object sender, EventArgs e)
    {
        string[] sapoint = new string[45];
        string[] val = new string[45];

        sapoint[1] = "1fdl";
        sapoint[2] = "2fdl";
        sapoint[3] = "3fdl";
        sapoint[4] = "4fdl";
        sapoint[5] = "1swdl";
        sapoint[6] = "2swdl";
        sapoint[7] = "3swdl";
        sapoint[8] = "4swdl";
        sapoint[9] = "1zjcydl";
        sapoint[10] = "2zjcydl";
        sapoint[11] = "3zjcydl";
        sapoint[12] = "4zjcydl";
        sapoint[13] = "1tldl";
        sapoint[14] = "2tldl";
        sapoint[15] = "3tldl";
        sapoint[16] = "4tldl";
        sapoint[17] = "1yxxs";
        sapoint[18] = "2yxxs";
        sapoint[19] = "3yxxs";
        sapoint[20] = "4yxxs";
        sapoint[21] = "1gjtrl";
        sapoint[22] = "2gjtrl";
        sapoint[23] = "3gjtrl";
        sapoint[24] = "4gjtrl";
        sapoint[25] = "0qcqbbydl";
        sapoint[26] = "0qcbjsl";
        sapoint[27] = "0rlmrl";
        sapoint[28] = "0pdchml";
        sapoint[29] = "0qchsl1";
        sapoint[30] = "0qchsl2";
        sapoint[31] = "0dwsdl";
        sapoint[32] = "0dwgdl";

        val[1] = this.fdl1.Value;
        val[2] = this.fdl2.Value;
        val[3] = this.fdl3.Value;
        val[4] = this.fdl4.Value;
        val[5] = this.swdl1.Value;
        val[6] = this.swdl2.Value;
        val[7] = this.swdl3.Value;
        val[8] = this.swdl4.Value;
        val[9] = this.zjcydl1.Value;
        val[10] = this.zjcydl2.Value;
        val[11] = this.zjcydl3.Value;
        val[12] = this.zjcydl4.Value;
        val[13] = this.tldl1.Value;
        val[14] = this.tldl2.Value;
        val[15] = this.tldl3.Value;
        val[16] = this.tldl4.Value;
        val[17] = this.yxxs1.Value;
        val[18] = this.yxxs2.Value;
        val[19] = this.yxxs3.Value;
        val[20] = this.yxxs4.Value;
        val[21] = this.gjtrl1.Value;
        val[22] = this.gjtrl2.Value;
        val[23] = this.gjtrl3.Value;
        val[24] = this.gjtrl4.Value;
        val[25] = this.qcqbbydl0.Value;
        val[26] = this.qcbjsl0.Value;
        val[27] = this.rlmrl0.Value;
        val[28] = this.pdchml0.Value;
        val[29] = this.qchsl10.Value;
        val[30] = this.qchsl20.Value;
        val[31] = this.dwsdl0.Value;
        val[32] = this.dwgdl0.Value;

        string date = DateTime.Parse(this.DateLR.Value).ToString("yyyy-MM-dd");

        bool flag = BE.SaveSGLRDAY(sapoint, val, date, out errMsg);

        if (flag == true)
            this.show.InnerHtml = "记录保存成功...";
        else
            this.show.InnerHtml = "保存失败...";



    }
}
